﻿@model DLMemberPointMS.Entity.ViewModel.UserInsertView

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>修改会员</title>
    <link rel="stylesheet" type="text/css" href="~/layui/css/layui.css" />
    <script src="~/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="~/Scripts/jquery-3.3.1.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
    @using (Html.BeginForm("UserInsert", "Users", FormMethod.Post, new { @class = "", id = "BIaodan" }))
    {
        @Html.AntiForgeryToken()
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px;">登录名：</label>
            <div class="layui-input-inline">
                @Html.EditorFor(model => model.U_LoginName, new { htmlAttributes = new { @class = "layui-input" } })
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px;">密码：</label>
            <div class="layui-input-inline">
                @Html.EditorFor(model => model.U_Password, new { htmlAttributes = new { @class = "layui-input" } })
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px;">真实姓名：</label>
            <div class="layui-input-inline">
                @Html.EditorFor(model => model.U_RealName, new { htmlAttributes = new { @class = "layui-input" } })
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px;">性别：</label>
            <div class="layui-input-inline">
               
                @Html.RadioButtonFor(model => model.U_Sex, "男") 男
                @Html.RadioButtonFor(model => model.U_Sex, "女") 女

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px;">联系电话：</label>
            <div class="layui-input-inline">
                @Html.EditorFor(model => model.U_Telephone, new { htmlAttributes = new { @class = "layui-input" } })

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px;">角色：</label>
            <div class="layui-input-inline">
                @*@Html.EditorFor(model => model.EG_Number, new { htmlAttributes = new { @class = "layui-input" } })*@
                @Html.DropDownList("U_Role", ViewData["Companys"] as IEnumerable<SelectListItem>, " ")

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px;">是否可以删除：</label>
            <div class="layui-input-inline">
                @Html.CheckBoxFor(model => model.U_CanDelete, new { htmlAttributes = new { @class = "layui-input" } }) 是

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                @*<a href="javascript:void(0)" id="btn_Submit" class="">提交</a>*@
                <button class="layui-btn" lay-submit lay-filter="submitform">修改</button>

            </div>
        </div>
        @Html.HiddenFor(Model => Model.U_ID)
    }
    <script type="text/javascript">
        layui.use(['form', 'layer'], function () {
            var form = layui.form
                , layer = layui.layer;
            form.on('submit(submitform)', function (data) {

                var U_ID = $('#U_ID').val();

                var index = parent.layer.getFrameIndex(window.name); //得到当前iframe层的索引

                var strdatas = $("#BIaodan").serializeArray();//序列化
                var url = '/User/UserUpda/' + U_ID;
             
                $.ajax({
                    type: "post",
                    url: url,
                    data: strdatas,
                    success: function (res) {
                        if (res.code == 0) {
                            parent.layer.msg(res.msg, { icon: 1 });
                            parent.layer.close(index); //再执行关闭

                        } else {
                            parent.layer.msg(res.msg, { icon: 5 });
                            parent.layer.close(index); //再执行关闭
                        }
                    },
                    error: function (res) {
                        parent.layer.msg(res.msg, { icon: 2 });
                        parent.layer.close(index); //再执行关闭
                    }
                })
                return false;
            });
        })

    </script>

</body>
</html>
